package cc.vv.btpartyjob.partyservice.adapter

import android.text.TextUtils
import android.widget.TextView
import cc.vv.baselibrary.adapter.SimpleCommonAdapter
import cc.vv.baselibrary.adapter.holder.ExtendViewHolder
import cc.vv.btpartyjob.partyservice.R
import cc.vv.btpartyjob.partyservice.module.bean.DemandBean

/**
 * 需求清单adapter
 * Created by Chen.qi on 2018/10/24.
 */
class DemandAdapter(layoutResId: Int) : SimpleCommonAdapter<DemandBean>(layoutResId) {
    override fun convert(helper: ExtendViewHolder, item: DemandBean, position: Int) {
        //title
        helper.getView<TextView>(R.id.tv_ideL_title)?.text = item.title

        //创建时间
        helper.getView<TextView>(R.id.tv_ideL_time)?.text = item.createTime

        //姓名
        helper.getView<TextView>(R.id.tv_ideL_name)?.text = item.principal

        //电话
        helper.getView<TextView>(R.id.tv_ideL_tel)?.text = item.mobile

        //酬劳
        if (TextUtils.isEmpty(item.amount) || "0" == item.amount) {
            helper.getView<TextView>(R.id.tv_ideL_money)?.text = "无"
        } else {
            helper.getView<TextView>(R.id.tv_ideL_money)?.text = item.amount
        }
    }
}